#ifndef LIST_H_
#define LIST_H_
#include "conf.h"

C_CODE_BEGIN
struct list;
EXPORT_FUNC struct list* list_create( size_t objsize ,size_t cache_size );

EXPORT_FUNC void list_destroy( struct list* );

EXPORT_FUNC void list_push_back( struct list* , void* obj );
EXPORT_FUNC void list_pop_back( struct list* );

EXPORT_FUNC void list_push_front( struct list* , void* obj );
EXPORT_FUNC void list_pop_front( struct list* );

EXPORT_FUNC void list_insert( struct list* , void* obj , void* where);
EXPORT_FUNC void list_erase( struct list* , void* where );

EXPORT_FUNC void* list_front( struct list* li );
EXPORT_FUNC void* list_back( struct list* li  );

EXPORT_FUNC void* list_head(struct list*);
EXPORT_FUNC void* list_tail(struct list*);
// 0 means stay , <0 means left , >0 means right
// if you want to have infinit loop you can use zero :)
EXPORT_FUNC void* list_move_list_node(int direction , void* , struct list* );
// prefer foreach
EXPORT_FUNC void list_foreach( struct list* , void(*func)( void* node,void* others) ,void* others);
EXPORT_FUNC void list_until( struct list* , bool (*func)(void* node,void* others), void* others );
EXPORT_FUNC void list_clear( struct list* );

EXPORT_FUNC size_t list_get_usesize( struct list* );
EXPORT_FUNC size_t list_get_objsize( struct list* );
C_CODE_END


#endif //LIST_H_